from flask import Flask
from flask_cors import CORS
from flask_bootstrap import Bootstrap

from zvms.views.user import User
from zvms.views.class_ import Class
from zvms.views.report import Report
from zvms.views.about import About
from zvms.views.main import Main
from zvms.views.notice import Notice
from zvms.util import auth2str, authorized

app = Flask(__name__)
app.config['SECRET_KEY'] = 'OudxlnrPCRcVcGpH'
app.debug = True

CORS(app, supports_credentials=True, resources={r"/*", "*"})
bootstrap = Bootstrap(app)

app.register_blueprint(User)
app.register_blueprint(Class)
app.register_blueprint(Report)
app.register_blueprint(About)
app.register_blueprint(Main)
app.register_blueprint(Notice)

app.add_template_filter(auth2str, 'auth2str')
app.add_template_filter(authorized, 'authorized')